package com.dwxt.parabolic.controller;

import com.dwxt.common.base.BaseResult;
import com.dwxt.common.base.Page;
import com.dwxt.parabolic.entity.Device;
import com.dwxt.parabolic.service.CompanyService;
import com.dwxt.parabolic.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/parabolic/device")
@RestController
public class DeviceController {

    @Autowired
    private DeviceService deviceService;

    /**
     * 分页查询设备列表
     *
     * @param page
     * @param device
     * @return
     */
    @RequestMapping("/list")
    public BaseResult getDeviceList(Page page, Device device) {
        return deviceService.getDeviceList(page, device);
    }

    /**
     * 添加设备
     */
    @RequestMapping("/add")
    public BaseResult add(Device device) {
        return deviceService.add(device);
    }

    /**
     * 修改设备
     */
    @RequestMapping("/update")
    public BaseResult update(Device device) {
        return deviceService.update(device);
    }

    /**
     * 删除设备
     *
     * @param id
     * @return
     */
    @RequestMapping("/delete")
    public BaseResult delete(String id) {
        return deviceService.delete(id);
    }

    /**
     * 查询公司的所有超脑
     */
    @RequestMapping("/list/all")
    public BaseResult getAllDeviceOfCompany(String companyId) {
        return deviceService.getAllDeviceOfCompany(companyId);
    }

    /**********************************调用超脑接口**********************************************/
    /**
     * 启动或结束超脑
     */
    @RequestMapping("/startOrEnd")
    public BaseResult startOrEnd(String id) {
        return deviceService.startOrEnd(id);
    }
    /**
     * 设备自检
     */
    @RequestMapping("/check")
    public BaseResult check(String id) {
        return deviceService.check(id);
    }

}
